//
//  BaseViewController.m
//
//  Created by 钮勇威 on 16/2/15.
//  Copyright © 2016年 阿毛. All rights reserved.
//

#import "BaseViewController.h"
//#import "AGGTabViewController.h"

@interface BaseViewController ()
@end

@implementation BaseViewController
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.automaticallyAdjustsScrollViewInsets = NO;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self drawView];
    [self initData];
    
//    //根据推送进行跳转
//    [NotificationCenter addObserver:self selector:@selector(receiveMessageDoJump:) name:DidReciveMessageRequestJump object:nil];
    
    //环信
//    if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)])
//    {
//        [self setEdgesForExtendedLayout:UIRectEdgeNone];
//    }
}

-(void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated]; 
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
}

-(void)receiveMessageDoJump:(NSNotification *)noticeInfo{
    NSDictionary *receiveInfo = noticeInfo.object;
    NSLog(@"%@",receiveInfo);
    
//    if ([self isVisable]) {
//        AGGTabViewController *sectionOne = [[AGGTabViewController alloc]init];
//        [self.navigationController pushViewController:sectionOne animated:YES];
//    }
}


#pragma mark 初始化数据
-(void)initData{
    
}

#pragma mark 绘制页面
//绘制view
-(void)drawView{
    
}



//页面是否处于显示状态
-(BOOL)isVisable{
    return (self.isViewLoaded && self.view.window);
}

//取消键盘
-(void)cancelKeyboard{
    [self.view endEditing:YES];
}

//取消键盘
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}

//-(BOOL)isCurrentViewControllerVisible:(UIViewController *)viewController
//{
//    return (viewController.isViewLoaded && viewController.view.window);
//}


-(void)dealloc{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    //NSLog(@"控制器被dealloc: %@", [[self class] description]);
}

@end
